tests: add whitespace tests for vertical tab behavior#155028
tests: add whitespace tests for vertical tab behavior#155028Brace1000 wants to merge 18 commits intorust-lang:mainfrom
Conversation
Add two small tests to highlight how vertical tab is handled differently. - vertical_tab_lexer.rs checks that the lexer treats vertical tab as whitespace - ascii_whitespace_excludes_vertical_tab.rs shows that split_ascii_whitespace does not split on it This helps document the difference between the Rust parser (which accepts vertical tab) and the standard library’s ASCII whitespace handling. See: rust-lang/rust-project-goals#53
|
rustbot has assigned @dingxiangfei2009. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
fix tidy: add whitespace README entry
This comment has been minimized.
This comment has been minimized.
arrange the tittle in alphabetical order
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
fix: remove unnecessary output from tests
This comment has been minimized.
This comment has been minimized.
| let x = 5; | ||
| let y = 10; | ||
| let z = x + y; | ||
|
|
There was a problem hiding this comment.
Since vertical tab doesn't show up in GitHub's PR review rendering, please put a comment above each line containing the whitespace.
You might want to add lines with each of the 11 permitted whitespace characters:
https://doc.rust-lang.org/reference/whitespace.html
And then some lines with the other 14 disallowed whitespace characters (the ones from this list marked White_Space, that aren't in the first list):
https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt
| @@ -0,0 +1,22 @@ | |||
| // This test checks that split_ascii_whitespace does NOT split on | |||
There was a problem hiding this comment.
I'm not sure if this test is relevant to the compiler?
tests/ui/README.md
Outdated
|
|
||
| Tests on `where` clauses. See [Where clauses | Reference](https://doc.rust-lang.org/reference/items/generics.html#where-clauses). | ||
|
|
||
| ## `whitespace` |
There was a problem hiding this comment.
This will need an explanation of why the whitespace tests are needed. It's a good place to mention that is_ascii_whitespace and is_whitespace in the standard library don't match the Rust language's definition of whitespace.
| // the standard library's is_ascii_whitespace does NOT include vertical | ||
| // tab, following the WhatWG Infra Standard instead. | ||
| // | ||
| // See: https://github.com/rust-lang/rust-project-goals/issues/53 |
There was a problem hiding this comment.
Where did you get this link? It's not the Outreachy tracking issue.
|
This comment has been minimized.
This comment has been minimized.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
This PR adds two small tests to highlight how vertical tab (\x0B)
is handled differently across Rust's whitespace definitions.
The Rust lexer treats vertical tab as whitespace (Unicode
Pattern_White_Space), while
split_ascii_whitespacefollows theWhatWG Infra Standard and does not include vertical tab.
These tests make that difference visible and easier to understand.
See: rust-lang/rust-project-goals#53